home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / Xm / XmRedisplayWidget.z / XmRedisplayWidget
Text File  |  1998-10-30  |  7KB  |  199 lines

  1.  
  2.  
  3.  
  4.      XXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeetttt((((3333XXXX))))     UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV     XXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeetttt((((3333XXXX))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           XXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeetttt - Synchronously activates the eeeexxxxppppoooosssseeee
  10.           method of a widget to draw its content
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.           #include <Xm/Xm.h>
  14.           vvvvooooiiiiddddXXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeetttt(
  15.           WWWWiiiiddddggggeeeettttwwwwiiiiddddggggeeeetttt);
  16.  
  17.      VVVVEEEERRRRSSSSIIIIOOOONNNN
  18.           This page documents Motif 2.1.
  19.  
  20.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  21.           This function is a convenience routine that hides the
  22.           details of the Xt internals to the application programmer by
  23.           calling the eeeexxxxppppoooosssseeeemethod of the given widget with a well
  24.           formed EEEExxxxppppoooosssseeeeevent and RRRReeeeggggiiiioooonnnncorresponding to the total area
  25.           of the widget. If the widget doesn't have an EEEExxxxppppoooosssseeeemethod,
  26.           the function does nothing.
  27.  
  28.           This is primarily used in the context of X Printing if the
  29.           programming model chosen by the application is _s_y_n_c_h_r_o_n_o_u_s;
  30.           that is, it doesn't rely of X Print events for the driving
  31.           of page layout but wants to completely control the sequence
  32.           of rendering requests.
  33.  
  34.           XXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeettttdoesn't clear the widget window prior to
  35.           calling the eeeexxxxppppoooosssseeeemethod, since this is handled by calls to
  36.           XXXXppppSSSSttttaaaarrrrttttPPPPaaaaggggeeee.
  37.  
  38.           _w_i_d_g_e_t    The widget to redisplay.
  39.  
  40.      RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  41.           None.
  42.  
  43.      EEEERRRRRRRROOOORRRRSSSS////WWWWAAAARRRRNNNNIIIINNNNGGGGSSSS
  44.           Not applicable
  45.  
  46.      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  47.           In the following, a simple application wants to print the
  48.           content of a multi-page text widget (similar to ddddttttppppaaaadddd).
  49.  
  50.           PrintOKCallback(print_dialog...)
  51.           /*-------------*/
  52.           {
  53.               pshell = XmPrintSetup (print_dialog, pbs->print_screen,
  54.                                              "Print", NULL, 0);
  55.  
  56.               XpStartJob(XtDisplay(pshell), XPSpool);
  57.  
  58.               /**** here I realize the shell, get its size, create my widget
  59.                hierarchy: a bulletin board, and then a text widget,
  60.  
  61.  
  62.  
  63.      Page 1                                         (printed 10/24/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      XXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeetttt((((3333XXXX))))     UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV     XXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeetttt((((3333XXXX))))
  71.  
  72.  
  73.  
  74.                that I stuff with the video text widget buffer */
  75.  
  76.               /* get the total number of pages to print */
  77.               XtVaGetValues(ptext, XmNrows, &prows,
  78.                                    XmNtotalLines, n_lines, NULL);
  79.               n_pages = n_lines / prows;
  80.  
  81.               /***** now print the pages in a loop */
  82.  
  83.               for (cur_page=0; cur_page != n_pages; cur_page++) {
  84.  
  85.                          XpStartPage(XtDisplay(pshell), XtWindow(pshell), False);
  86.                          XmRedisplayWidget(ptext);  /* do the drawing */
  87.                          XpEndPage(XtDisplay(pshell));
  88.  
  89.                   XmTextScroll(ptext, prows);  /* get ready for next page */
  90.               }
  91.  
  92.               /***** I'm done */
  93.               XpEndJob(XtDisplay(pshell));
  94.  
  95.           }
  96.  
  97.           Of course, one could change the above code to include it in
  98.           a ffffoooorrrrkkkk(((())))branch so that the main program is not blocked while
  99.           printing is going on. Another way to achieve a "print-in-
  100.           the-background" effect is to use an Xt workproc. Using the
  101.           same sample application, that gives us:
  102.  
  103.           Boolean
  104.           PrintOnePageWP(XtPointer npages) /* workproc */
  105.           /*-------------*/
  106.           {
  107.               static int cur_page = 0;
  108.               cur_page++;
  109.  
  110.               XpStartPage(XtDisplay(pshell), XtWindow(pshell), False);
  111.               XmRedisplayWidget(ptext);  /* do the drawing */
  112.               XpEndPage(XtDisplay(pshell));
  113.  
  114.               XmTextScroll(ptext, prows);  /*  get ready for next page */
  115.  
  116.               if (cur_page == n_pages) { /***** I'm done */
  117.                   XpEndJob(XtDisplay(pshell));
  118.  
  119.                   XtDestroyWidget(pshell);
  120.                   XtCloseDisplay(XtDisplay(pshell));
  121.               }
  122.  
  123.               return (cur_page == n_pages);
  124.           }
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                         (printed 10/24/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      XXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeetttt((((3333XXXX))))     UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV     XXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeetttt((((3333XXXX))))
  137.  
  138.  
  139.  
  140.           PrintOKCallback(...)
  141.           /*-------------*/
  142.           {
  143.               pshell = XmPrintSetup (widget, pbs->print_screen,
  144.                                              "Print", NULL, 0);
  145.  
  146.               XpStartJob(XtDisplay(pshell), XPSpool);
  147.  
  148.               /**** here I get the size of the shell, create my widget
  149.                     hierarchy: a bulletin board, and then a text widget,
  150.                             that I stuff with the video text widget buffer */
  151.  
  152.               /* get the total number of pages to print */
  153.               /* ... same code as above example */
  154.  
  155.               /***** print the pages in the background */
  156.               XtAppAddWorkProc(app_context, PrintOnePageWP, n_pages);
  157.           }
  158.  
  159.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  160.           XXXXmmmmPPPPrrrriiiinnnnttttSSSSeeeettttuuuupppp(3), XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll(3)
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                         (printed 10/24/98)
  196.  
  197.  
  198.  
  199.